/**
 * 非特殊情况，接口url都是当前部署域
 * 特殊情况在此配置
 * 假如支持不同服务接口，需要额外配置，此处预留接口，形如"/otherApi/**"
 * 也就是api开头的接口baseUrl全部走default对象，其他开头走其他对象
 */
import config from './index';

const { protocol } = window.location;

const wsProtocol = protocol === 'http:' ? 'ws:' : 'wss:';
const origin = 'http://192.168.0.149:7002'
const baseUrls: { [key: string]: { [key: string]: string } } = {
	api: {
		development: origin,
		test: origin,
		production: origin,
	},
	// mgmt: {
	//   development: 'http://192.168.3.90:8087',
	// 	beta: origin,
	// 	production: origin,
	// },
	otherApi: {}, // 此对象举例预留
};

const wsUrls: { [key: string]: string } = {
	development: wsProtocol + origin.replace(/https?:/, ''),
	test: wsProtocol + origin.replace(/https?:/, ''),
	production: wsProtocol + origin.replace(/https?:/, ''),
};

export const wsUrl = wsUrls[config.env];

export default baseUrls;
